<template>
  <div class="login-box" v-loading.fullscreen="loadingVisible">
    
    <div class="container-box">
      <div class="left-box">
        <p class="fr-title">金融理财产品推荐系统</p>
        <p class="wellcome">加入我们吧</p>
        <p class="detail">这是一个金融投资产品推荐系统，一款让更多人收益的金融投资平台</p>
        <el-button @click="login" class="reg-btn" round>已注册，去登录</el-button>
        <div class="circle"></div>
        <div class="fk"></div>
        <div class="jx"></div>
      </div>
      <div class="right-box">
        <p class="login-text">注册账号</p>
        <!--<el-form class="myForm" ref="ruleForm" :rules="rules" v-model="myForm" label-width="100px">-->
        <!--  <el-form-item prop="username" label="用户名" style="margin: 25px 0">-->
        <!--    <el-input v-model="myForm.username" placeholder="请输入用户名"></el-input>-->
        <!--  </el-form-item>-->
        <!--  <el-form-item prop="password" label="密码">-->
        <!--    <el-input type="password" v-model="myForm.password" placeholder="请输入密码"></el-input>-->
        <!--  </el-form-item>-->
        <!--  <el-form-item prop="phone" label="电话">-->
        <!--    <el-input v-model="myForm.phone" placeholder="请输入电话"></el-input>-->
        <!--  </el-form-item>-->
        <!--  <el-form-item prop="realName" label="真实姓名">-->
        <!--    <el-input  v-model="myForm.realName" placeholder="请输入真实姓名"></el-input>-->
        <!--  </el-form-item>-->
        <!--  <el-form-item prop="address" label="地址">-->
        <!--    <el-input  v-model="myForm.address" placeholder="请输入地址"></el-input>-->
        <!--  </el-form-item>-->
        <!--  <el-form-item prop="email" label="邮箱">-->
        <!--    <el-input  v-model="myForm.email" placeholder="请输入邮箱"></el-input>-->
        <!--  </el-form-item>-->
        <!--  <el-form-item style="margin: 0 100px">-->
        <!--    <el-button v-loading="loadingVisible" @click="Login" type="primary">登录</el-button>-->
        <!--  </el-form-item>-->
        <!--</el-form>-->
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="myForm">
          <el-form-item label="用户名" prop="username">
            <el-input v-model="ruleForm.username"></el-input>
          </el-form-item>
          <el-form-item label="密码" prop="password">
            <el-input type="password" v-model="ruleForm.password"></el-input>
          </el-form-item>
          <el-form-item label="电话" prop="phone">
            <el-input v-model="ruleForm.phone"></el-input>
          </el-form-item>
          <el-form-item label="真实姓名" prop="realName">
            <el-input v-model="ruleForm.realName"></el-input>
          </el-form-item>
          <el-form-item label="地址" prop="address">
            <el-input v-model="ruleForm.address"></el-input>
          </el-form-item>
          <el-form-item label="邮箱" prop="email">
            <el-input  v-model="ruleForm.email"></el-input>
          </el-form-item>
          <el-form-item style="margin: 0 100px">
           <el-button @click="register" type="primary">注册</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "Register",
  data() {
    return {
      ruleForm: {
        username: '',
        password: '',
        phone: '',
        realName: '',
        address: '',
        email: '',
        assets: 0,
        img: '/img/hbfu.jpg'
      },
      rules: {
        username: [
          {required: true, message: '请输入用户名', trigger: 'blur'},
          {min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur'}
        ],
        password: [
          {required: true, message: '请输入密码', trigger: 'blur'},
          {min: 6, max: 15, message: '长度在 6 到 15 个字符', trigger: 'blur'}
        ],
        phone: [
          { required: true, message: '请输入电话', trigger: 'blur'}
        ],
        realName: [
          { required: true, message: '请输入真实姓名', trigger: 'blur'}
        ],
        address: [
          { required: true, message: '请输入地址', trigger: 'blur'}
        ],
        email: [
          {type:'email', required: true, message: '请输入邮箱', trigger: 'blur'}
        ],
      }
    }
  },
  methods:{
    register(){
      axios.post('/FinancialRecommend/user/register',this.ruleForm)
      .then(response =>{
        debugger
          this.$message.success(response.data.msg)
      })
    },
    login(){
      this.$router.push("/")
    }
  }
}
</script>

<style lang="less" scoped>
.left-box {
  width: 400px;
  height: 100%;
  border-radius: 20px 0 0 20px;
  background-color: rgb(43, 193, 123);
}

.right-box {
  width: 600px;
  height: 100%;
  background-color: white;
  border-radius: 0 20px 20px 0;
  
}

.login-box {
  position: absolute;
  bottom: 0;
  width: 99%;
  height: 100%;
  box-sizing: border-box;
  background-color: #e8ebeb;
}

.container-box {
  position: absolute;
  top: 70px;
  left: 255px;
  width: 1000px;
  height: 600px;
  display: flex;
  border-radius: 20px;
  //box-shadow: 18px 8px 15px 0px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
}

.fr-title {
  text-align: center;
  font-size: 30px;
  font-family: 新宋体;
  font-weight: 600;
  color: black;
  margin-top: 70px;
}

.login-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 400px;
  height: 170px;
  margin-left: -233px;
  margin-top: -150px;
  padding: 40px;
  border-radius: 15px;
  background-color: white;
}

.login-btn {
  text-align: center;
  margin: 0 140px;
}

.wellcome {
  text-align: center;
  font-family: 新宋体;
  font-size: 30px;
  font-weight: 600;
  color: black;
  margin-top: 100px;
}

.detail {
  text-align: center;
  font-size: 16px;
  font-family: 新宋体;
  margin: 50px 50px;
}

//注册按钮
.reg-btn {
  width: 150px;
  height: 50px;
  margin: 0 125px;
  font-family: 新宋体;
}

.circle {
  position: absolute;
  bottom: 0;
  width: 200px;
  height: 200px;
  border-radius: 0 200px 0 20px;
  background-color: rgb(45, 199, 127);
}

.fk {
  width: 50px;
  height: 50px;
  background-color: rgb(45, 199, 127);
  position: absolute;
  top: 110px;
  left: 300px;
  transform: rotate(60deg);
}

.myForm {
  margin: 25px 100px;
}

.login-text {
  text-align: center;
  font-size: 30px;
  font-family: 新宋体;
  font-weight: 600;
  color: black;
  margin-top: 50px;
}

.jx {
  width: 100px;
  height: 30px;
  background-color: rgb(45, 199, 127);
  position: absolute;
  top: 480px;
  left: 300px;
  transform: rotate(60deg);
}

p {
  user-select: none;
}
</style>
